import 'package:get/get.dart';

import '../my_page/my_logic.dart';
import 'list_binding.dart';

class ListLogic extends GetxController {
  final msg = ''.obs;
  final id = 0.obs;

  //  共享的 MyLogic（响应式）
  late final MyLogic myLogic;

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    // query 参数：/list?id=22 或 parameters: {'id':'22'}
    id.value = int.tryParse(Get.parameters['id'] ?? '') ?? 0;
    final args = (Get.arguments ?? {}) as Map;
    msg.value = args['msg'] ?? '';
    // 同一实例，能实时联动
    myLogic = args['mylogic'] as MyLogic;
  }
}
